<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<% String path=request.getContextPath(); String basePath=request.getScheme()+ "://" + request.getServerName() + ":" + request.getServerPort() + path+ "/"; %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" >
<html xmlns="http://www.w3.org/1999/xhtml">
<html>
<head>
    <base href="<%=basePath%>">
    <title>携程对账查询</title>
    <%@ include file="/WEB-INF/jsp/common/common.jsp" %>
    <script src="<%=path%>/js/jquery.divbox.js" type="text/javascript"></script>
    <script src="js/json2.js" type="text/javascript"></script>
    <script type="text/javascript">

        $(document).ready(function () {

        });

        function queryCtripPage(pageIndex) {

            if(pageIndex == null){
                pageIndex = 1;
            }

            var dateBegin = $.trim($("#dateBegin").val());
            var dateEnd = $.trim($("#dateEnd").val());

            $.openLoading();
            $.ajax({
                url : "<%=path%>/ctrip/queryStatisticsPage",
                type : 'POST',
                async : false,
                dataType:'json',
                data:{
                    current:pageIndex,
                    size:10,
                    dateBegin:dateBegin,
                    dateEnd:dateEnd
                },
                success:function (page) {
                    $.closeLoading();
                    if($.validate(page)){
                        return;
                    }

                    var lastbutton = "<a href='javascript:void(0)' onClick='toDetail(this);return false'>详情</a>";
                    var tableContent = creatTable("effecttime,policyCount,sumPremium,successCount,successPremium,failCount,failPremium,riderCount,sumRiderPremium,failRiderCount,failRiderPremium",page,lastbutton);

                    var tableObj = $("#ctripTable");
                    tableObj.find("tbody").remove();
                    tableObj.append(tableContent);
                    var strPage = creatChannelPage(pageIndex,6,page.maxPage,"113");
                    var pageDIV = $("#ctripPage");
                    pageDIV[0].innerHTML="";
                    pageDIV.append(strPage);
                }
            });
        }

        function reset() {
            $('#ctripListForm input[type!="button"]').val("");
        }

        function toDetail(obj) {
            var detailTr = $(obj).parent('td').parent('tr')[0];
            var effecttime = detailTr.childNodes[0].innerHTML;//交易日期
            var failPremium = detailTr.childNodes[6].innerHTML;//当天异常保费
            var count = detailTr.childNodes[5].innerHTML;//对账异常保单数量
            /*去详情页*/
            window.location.href="<%=path%>/ctrip/detail?effecttime=" + effecttime + "&failPremium=" + failPremium + "&count=" + count;
        }

    </script>
</head>
<body>

    <div class="current">
        <table class="current_table_1">
            <tbody>
            <tr class="f2">
                <td>
                    <img src="./images/current_1.jpg">
                </td>
                <td class="current_table_1_td">
                    <img src="images/current_1.png">&nbsp;您现在的位置：&nbsp;
                    <span style=" color:#136bab; ">携程旅游
                        <span style="padding:0 5px; font-weight:bold; line-height:28px;">&gt;</span>对账查询
                    </span>
                </td>
                <td><img src="./images/current_3.jpg"></td>
            </tr>
            </tbody>
        </table>
    </div>

    <%--查询条件及结果表单--%>
    <table border="1" class="table_02" style="height:150px">
        <tr height="50px">
            <td colspan="2" align="center">
                <form method="post" id="ctripListForm">
                    <table border="0" style="margin: 12px auto;">
                        <tr>
                            <td style="border: 0;text-align: right;" nowrap="nowrap">交易日期：</td>
                            <td style="border: 0;text-align: left;padding-right: 70px">
                                <input id="dateBegin" name="dateBegin" readonly="readonly" onclick="showCalendar('dateBegin','y-mm-dd');"  class="input_time"/>
                            </td>

                            <td style="border: 0;text-align: right;" nowrap="nowrap">至：</td>
                            <td style="border: 0;text-align: left;padding-right: 70px">
                                <input id="dateEnd" name="dateEnd" readonly="readonly" onclick="showCalendar('dateEnd','y-mm-dd');"  class="input_time"/>
                            </td>
                        </tr>
                        <tr>
                            <td colspan="6" style="border: 0;padding-top: 5px;padding-right: 70px">
                                <input type="button"  class="input_button_1"  value="查询" onClick="queryCtripPage()"/>
                                <input type="button"  class="input_button_1"  value="重置" onClick="reset()"/>
                            </td>
                        </tr>
                    </table>
                </form>
            </td>
        </tr>
        <tr>
            <td valign="top">
                <div id="ctripPageDiv" style="width:98%;margin:5px" >
                    <table class="table_02" id="ctripTable">
                        <thead>
                        <tr>
                            <th style="width:10%" nowrap="nowrap">交易日期</th>
                            <th style="width:6%" nowrap="nowrap">保单数量</th>
                            <th style="width:8%" nowrap="nowrap">保单保费(元)</th>
                            <th style="width:10%" nowrap="nowrap">对账成功保单数量</th>
                            <th style="width:10%" nowrap="nowrap">对账成功保费(元)</th>
                            <th style="width:10%" nowrap="nowrap">对账异常保单数量</th>
                            <th style="width:12%" nowrap="nowrap">对账异常保单保费(元)</th>
                            <th style="width:6%" nowrap="nowrap">批单数量</th>
                            <th style="width:8%" nowrap="nowrap">批单保费(元)</th>
                            <th style="width:10%" nowrap="nowrap">对账异常批单数量</th>
                            <th style="width:12%" nowrap="nowrap">对账异常批单保费(元)</th>
                            <th style="width:11%" nowrap="nowrap">异常保单/批单详情</th>
                        </tr>
                        </thead>
                        <tbody>
                        </tbody>
                    </table>
                    <%--分页--%>
                    <div id="ctripPage"  class="page"></div>
                </div>
            </td>
        </tr>
    </table>

</body>
</html>
